extends Card


func play_on_release(card_view: CardView) -> void:
	var player = card_view.get_tree().get_first_node_in_group("player")
	var player_state: PlayerInBattleState = Globals.player_state
	var tween := card_view.create_tween()
	tween.tween_callback(Shake.state_play.bind(player, StateBar.STATE.COUNTER_ATTACK, self.counter_attack, self.duration))
	tween.tween_callback(
		Shake.state_play.bind(player, StateBar.STATE.SHIELD, self.shield, self.duration)
	).set_delay(0.3)
	tween.tween_interval(0.51)
	await tween.finished
	Globals.player_state.counter_attack += self.counter_attack
	Globals.player_state.shield += card_view.card.shield
	card_view.play_on_release_signal_finish.emit()

	
func get_desc() -> String:
	if desc_lab == "":
		return ""
	var text = (
		desc_lab
		% [
			get_final_shield_str(),
			self.counter_attack
		]
	)
	return text


func init_from_csv(introduce):
	super.init_from_csv(introduce)
	self.shield = int(introduce[5])
	self.counter_attack = int(introduce[6])
